
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/tutor/template/main.xhtml">

	<ui:define name="body">
		<h:form>
			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton title="#{messages['button.new']}"
						icon="ui-icon-document" action="#{atividadeListMB.getNextView}"
						actionListener="#{atividadeListMB.clear}" ajax="false" />

					<p:commandButton title="#{messages['button.delete']}"
						icon="ui-icon-trash" onclick="confirmation.show()" type="button"
						immediate="true" ajax="false" />

					<h:outputLabel value="#{messages['tutor.label.filtro']}: "
						for="filtro" styleClass="text-input" />
					<h:inputText id="filtro" value="#{atividadeListMB.filtro}"
						title="#{messages['tutor.alt.filtro']}" />

					<h:outputLabel value="#{messages['tutor.label.tipofitro']}: "
						for="tipoFiltro" styleClass="text-input" />
					<h:selectOneMenu id="tipoFiltro"
						value="#{atividadeListMB.tipoFiltro}"
						title="#{messages['tutor.alt.tipofiltro']}">
						<f:selectItem itemValue="todos" itemLabel="Todos" />
						<f:selectItem itemValue="nome" itemLabel="Nome" />
						<f:selectItem itemValue="tutor" itemLabel="Tutor" />
					</h:selectOneMenu>

					<p:commandButton title="#{messages['button.search']}"
						icon="ui-icon-search" actionListener="#{atividadeListMB.list()}"
						ajax="false" />

					<p:confirmDialog message="#{messages['label.confirm.delete']}"
						showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.alert']}!" severity="alert"
						widgetVar="confirmation">

						<h:commandButton value="#{messages['button.dialog.yes']}"
							action="#{atividadeListMB.deleteSelection}"
							actionListener="#{atividadeListMB.clear}" />
						<h:commandButton value="#{messages['button.dialog.no']}"
							onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>
			<p:dataTable id="list" var="bean"
				value="#{atividadeListMB.resultList}">
				<f:facet name="header">#{messages['atividade.list.table.title']}</f:facet>
				<p:column style="width:1%;">
					<h:selectBooleanCheckbox
						value="#{atividadeListMB.selection[bean.id]}"></h:selectBooleanCheckbox>
				</p:column>

				<p:column style="width:5%;" sortBy="#{bean.id}">
					<f:facet name="header">#{messages['atividade.label.id']}</f:facet>
					<h:outputText value="#{bean.id}" />
				</p:column>

				<p:column sortBy="#{bean.nome}">
					<f:facet name="header">#{messages['atividade.label.nome']}</f:facet>
					<h:commandLink action="#{atividadeListMB.getNextView}"
						actionListener="#{atividadeListMB.clear}">
						<h:outputText value="#{bean.nome}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>

				<p:column sortBy="#{bean.tutor}">
					<f:facet name="header">#{messages['atividade.label.tutor']}</f:facet>
					<h:commandLink action="#{atividadeListMB.getNextView}"
						actionListener="#{atividadeListMB.clear}">
						<h:outputText value="#{bean.tutor.usuario.nome}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
				
				<p:column style="width:30px;">
					<f:facet name="header">#{messages['tutor.label.acoes']}</f:facet>
					<h:commandLink action="#{atividadeAddTurmaMB.outcome}">
						<span class="ui-icon ui-icon-person" style="float: left;"
							title="#{messages['button.add.atividade.turma']}"></span>
						<f:param name="id" value="#{bean.id}" />
						
						<f:setPropertyActionListener target="#{atividadeAddTurmaMB.parametro}"
							value="#{bean.id}" />
					</h:commandLink>
					
					<h:commandLink action="#{atividadeAddGrupoMB.outcome}">
						<span class="ui-icon ui-icon-check" style="float: left;"
							title="#{messages['button.add.atividade.grupo']}"></span>
						<f:param name="id" value="#{bean.id}" />
						
						<f:setPropertyActionListener target="#{atividadeAddGrupoMB.parametro}"
							value="#{bean.id}" />
					</h:commandLink>
					
				</p:column>

			</p:dataTable>
		</h:form>

	</ui:define>
</ui:composition>